<?php
Yii::app()->clientScript->registerScriptFile($this->adminPath."/js/jquery-ui-1.8.11.custom.min.js",CClientScript::POS_HEAD);
Yii::app()->clientScript->registerScriptFile($this->adminPath."/js/art-dialog/jquery.artDialog.js",CClientScript::POS_HEAD);
Yii::app()->clientScript->registerScriptFile($this->adminPath."/js/art-dialog/plugins/iframeTools.js",CClientScript::POS_HEAD);
?>
<link rel="stylesheet" type="text/css" href="<?php echo $this->adminPath; ?>/css/jquery-ui.css" />
<link rel="stylesheet" type="text/css" href="<?php echo $this->adminPath; ?>/js/art-dialog/skins/blue.css" />
<style type="text/css">
    .st-labeltext {
        color: #3C5868;
        display: block;
        float: left;
        font-size: 12px;
        line-height: 20px;
        padding-right: 10px;
        padding-top: 3px;
        width: 60px;
    }
    li.seleced{
        background-color: #ccc;
    }
    li:hover{
        background-color: #ccc;
    }
</style>
<form id="form"  method="post" >
<div class="st-form-line" style="z-index: 580;">
    <span class="st-labeltext">搜索名称:</span>
    <input type="text" value=""  name="title" style="width:300px;margin-bottom: 10px;float: left" id="title" class="st-success-input validate[required,maxSize[50]]"  data-errormessage-range-overflow="景点名称不得大于50个字" data-errormessage-value-missing="景点名称不得为空" >
    <input type="submit" class="st-button" value="搜索" id="submit" name="button">
    <div class="clear" style="z-index: 570;"></div>
</div>
</form>
<div id="re" class="st-form-line button-box" style="z-index: 460;">
    <ul>
        <?php foreach($list as $v): ?>
            <?php
                if($v->type =='景点'){
                    $ctype = 'destination';
                }elseif($v->type =='酒店'){
                    $ctype = 'hotel';
                }elseif($v->type =='农家院'){
                    $ctype = 'farm';
                }elseif($v->type =='度假村'){
                    $ctype = 'resort';
                }elseif($v->type =='采摘园'){
                    $ctype = 'pick';
                }elseif($v->type =='玩点'){
                    $ctype = 'weekly';
                }
            ?>

        <li data-type="<?php echo $ctype; ?>" data-code="<?php echo $v->token; ?>" data-id="<?php echo $v->id; ?>" data-name="<?php echo $v->title; ?>" style="padding:10px 5px;cursor: pointer;"><label><?php echo $v->title; ?></label></li>
        <?php endforeach; ?>
    </ul>
    <input type="hidden" id="aid">
    <input type="hidden" id="atitle">
    <input type="hidden" id="atoken">
    <input type="hidden" id="atype">
    <div class="clear" style="z-index: 620;"></div>
</div>
<div class="st-form-line button-box" style="z-index: 460;">
    <div id="pager" style="z-index: 960;">
        <?php
        $this->widget('CLinkPager',array(
                'header'=>'',
                'firstPageLabel' => '首页',
                'lastPageLabel' => '末页',
                'prevPageLabel' => '上一页',
                'nextPageLabel' => '下一页',
                'pages' => $pages,
                'maxButtonCount'=>5,
                'htmlOptions'=>array(
                    'class'=>'pagination',
                ),
            )
        );
        ?>
    </div>
</div>
<div class="st-form-line button-box" style="z-index: 460;">
    <input type="button" style="margin: 10px 0 0 160px" class="st-button" value="确定" id="button" name="button">
</div>
<script type="text/javascript">
    $(function(){
         $("#re ul li").click(function(){
             $("#re ul li").removeClass("seleced");
              $(this).addClass("seleced");
              var aid = $(this).attr("data-id");
              var atitle = $(this).attr("data-name");
              var atoken = $(this).attr("data-code");
              var atype = $(this).attr("data-type");
              $("#aid").val(aid);
              $("#atitle").val(atitle);
              $("#atoken").val(atoken);
              $("#atype").val(atype);
         });
        $("#button").click(function(){
            var a_id = $("#aid").val();
            var a_title = $("#atitle").val();
            var atoken = $("#atoken").val();
            var atype = $("#atype").val();
            art.dialog.data('aid',a_id);
            art.dialog.data('atitle',a_title);
            art.dialog.data('atoken',atoken);
            art.dialog.data('atype',atype);
            art.dialog.close();
        });
    });
</script>
